Dynomotion

Group: DynoMotion Message: 3521 From: himykabibble Date: 1/28/2012
Subject: KMotion Crash
I've implemented most of the PC_COMM functions, but they are causing a very nasty crash that fills the screen with error dialogs. I'm calling the PC_COMM handler from a 100mSec timer event. Right now, virtually all the code is commented out, so it does nothing but read the command from Persist[100], do the switch statement based on that value, and each case simple clears Persist[100]. Nothing else happening. The write to clear Persist[100] seems to be doing something very nasty inside (I would guess) dotNet. If I step through the code, it works OK, no exceptions thrown. But, at some point shortly AFTER my code has returned, I get the pop-up window asking me if I want to launch the debugger. The screen is then filled with error dialogs telling me the compile of my init.c has failed. That error comes from within my KM_Controller init code, and is only executed once on a new connection. At this point, the board, and/or KMotion and/or dotNet are dead, and a disconnect is required to restore function. If I do that write to ANY other Persist var, there is no problem at all - it is ONLY writing Persist[100] that causes the failure. Is there something in dotNet that is looking at the command word, and taking some action based on its state?

Regards,
Ray L.
Group: DynoMotion Message: 3522 From: Tom Kerekes Date: 1/28/2012
Subject: Re: KMotion Crash
Hi Ray,
 
I'm not sure what the underlying problem is but you should be aware of something about the way Windows works that I run into all the time.  And I'm no sure how things are different under .NET.  But if you have something like a 100mSec Timer event which which detects something it needs to do, but then that thing puts up a MessageBox, then while the MessageBox is up you will continue to receive Timer Events (even though you never finished or exited from the first).  These new events will most likely decide to do the same thing as the first one which results in a mess of messages.
 
I've never found a good solution to this.  I usually just set a global flag before putting up a MessageBox that prevents anything else from doing anything.
 
Regards
TK